package com.cyanite.playlv2api.types;

import com.cyanite.playlv2api.util.ParcelUtils;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

public class Task implements PlayLv2Type, Parcelable {

	private String mId;
	private String mTripId;
	private String mTripName;
	private String mUserName;
    private String mUserId;
    private String mUserPhoto;
	private int mSecretLevel;  // 1 public // 2 friend // privacy
	private String mPhotoId;
	private String mPhoto;
	private Bitmap mPhotoBmp;
	private String mVenueName;
	private String mVenueId;
	private String mPostDate;
	private Info mInfo;
	private int mAccessway;
	private int mTipsCount;
    private String mLongitude;
    private String mLatitude;
    private String mTaskCategroyId;
    private int mDistance;

	public Task() {
	    mAccessway = 1;
	    mInfo = new Info();
    }

    private Task(Parcel in) {
        mId = ParcelUtils.readStringFromParcel(in);
        mTripId = ParcelUtils.readStringFromParcel(in);
        mTripName = ParcelUtils.readStringFromParcel(in);
        mUserId = ParcelUtils.readStringFromParcel(in);
        mUserName = ParcelUtils.readStringFromParcel(in);
        mUserPhoto = ParcelUtils.readStringFromParcel(in);
        mPhoto = ParcelUtils.readStringFromParcel(in);
        mVenueName = ParcelUtils.readStringFromParcel(in);
        mVenueId = ParcelUtils.readStringFromParcel(in);
        mPostDate = ParcelUtils.readStringFromParcel(in);
        mAccessway = Integer.valueOf(ParcelUtils.readStringFromParcel(in));
        mTipsCount = Integer.valueOf(ParcelUtils.readStringFromParcel(in));
        mDistance = Integer.valueOf(ParcelUtils.readStringFromParcel(in));
        mLongitude = ParcelUtils.readStringFromParcel(in);
        mLatitude = ParcelUtils.readStringFromParcel(in);
        if (in.readInt() == 1) {
            mInfo = in.readParcelable(Info.class.getClassLoader());
        }
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        ParcelUtils.writeStringToParcel(out, mId);
        ParcelUtils.writeStringToParcel(out, mTripId);
        ParcelUtils.writeStringToParcel(out, mTripName);
        ParcelUtils.writeStringToParcel(out, mUserId);
        ParcelUtils.writeStringToParcel(out, mUserName);
        ParcelUtils.writeStringToParcel(out, mUserPhoto);
        ParcelUtils.writeStringToParcel(out, mPhoto);
        ParcelUtils.writeStringToParcel(out, mVenueName);
        ParcelUtils.writeStringToParcel(out, mVenueId);
        ParcelUtils.writeStringToParcel(out, mPostDate);
        ParcelUtils.writeStringToParcel(out, String.valueOf(mAccessway));
        ParcelUtils.writeStringToParcel(out, String.valueOf(mTipsCount));
        ParcelUtils.writeStringToParcel(out, String.valueOf(mDistance));
        ParcelUtils.writeStringToParcel(out, mLongitude);
        ParcelUtils.writeStringToParcel(out, mLatitude);

        if (mInfo != null) {
            out.writeInt(1);
            out.writeParcelable(mInfo, flags);
        } else {
            out.writeInt(0);
        }
    }

    public static final Parcelable.Creator<Task> CREATOR = new Parcelable.Creator<Task>() {
        public Task createFromParcel(Parcel in) {
            return new Task(in);
        }

        @Override
        public Task[] newArray(int size) {
            return new Task[size];
        }
    };

    public String getId()   {
        return mId;
    }

	public void setId(String id){
		mId = id;
	}

	public String getTripId()   {
        return mTripId;
    }

    public void setTripId(String id){
        mTripId = id;
    }

    public String getTripName()   {
        return mTripName;
    }

    public void setTripName(String name){
        mTripName = name;
    }

	public String getTaskCategoryId()   {
        return mTaskCategroyId;
    }

    public void setTaskCategoryId(String id){
        mTaskCategroyId = id;
    }

	public String getUserName() {
        return mUserName;
    }

	public void setUserName(String username) {
        mUserName = username;
    }

	public void setLongitude(String longtitude)   {
        mLongitude = longtitude;
    }

    public String getLongitude(){
        return mLongitude;
    }

    public void setLatitude(String latitude)   {
        mLatitude = latitude;
    }

    public String getLatitude(){
        return mLatitude;
    }

	public String getPostDate()    {
	    return mPostDate;
	}

	public void setPostDate(String date)   {
	    mPostDate = date;
	}

    public String getUserId()  {
        return mUserId;
    }

    public void setUserId(String userId)  {
        mUserId = userId;
    }

	public void setSecretLevel(int level)  {
	    mSecretLevel = level;
	}

	public int getSecretLevel(){
		return mSecretLevel;
	}

	public void setTipsCount(int count)    {
	    mTipsCount = count;
	}

	public int getTipsCount()   {
	    return mTipsCount;
	}

	public void setDistance(int distance)    {
        mDistance = distance;
    }

    public int getDistance()   {
        return mDistance;
    }

    public void setPhoto(String photo) {
        mPhoto = photo;
    }

    public String getPhoto()   {
        return mPhoto;
    }

    public void setPhotoBitmap(Bitmap photo) {
        mPhotoBmp = photo;
    }

    public Bitmap getPhotoBitmap()   {
        return mPhotoBmp;
    }

	public void setPhotoId(String id) {
	    mPhotoId = id;
	}

	public String getPhotoId()   {
		return mPhotoId;
	}

	public void setVenueId(String id)  {
	    mVenueId = id;
	}

	public String getVenueId()    {
	    return mVenueId;
	}

	public void setVenueName(String name){
	    mVenueName = name;
	}

	public String getVenueName(){
		return mVenueName;
	}

	public void setInfo(Info info)    {
	    mInfo = info;
	}

	public Info getInfo()  {
		return mInfo;
	}

    public void setAccessway(int way){
        mAccessway = way;
    }

    public int getAccessway(){
        return mAccessway;
    }

    public void setUserPhoto(String photo)    {
        mUserPhoto = photo;
    }

    public String getUserPhoto()  {
        return mUserPhoto;
    }

	public void reset()    {

	}

    @Override
    public int describeContents() {
        return 0;
    }

}
